#project( cvpr_tutorial ) 

cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0014 OLD)

# This is a CMake helper script used to run pdflatex.
# The reason for needing this script is to set the TEXINPUTS environment variable
# Environment variables cannot be set directly for commands in add_custom_command
# The solution is to call
#
# add_custom_command(OUTPUT document.pdf
#   COMMAND ${CMAKE_COMMAND}
#     -D SOURCE_TEX:FILEPATH=document.tex
#     -D TEXINPUTS:FILEPATH=.:path/to/included/files:another/path:
#     -D OUTPUT_DIR:FILEPATH=path/to/output/directory
#     -P path/to/RunPDFLatex.cmake
#   )


find_package(LATEX)

set(ENV{TEXINPUTS} ${TEXINPUTS})
execute_process(COMMAND ${PDFLATEX_COMPILER} ${SOURCE_TEX} -output-directory ${OUTPUT_DIR})

